

import { loadBlogData } from './utils';

export default async (req, res) => {
    try {

    const data = loadBlogData()
       var categorys= data.reduce((acc, obj) => {
            return acc.concat(obj.category)
        }, [])
        categorys = [...new Set(categorys)]
        res.status(200).json( {
            'category' : categorys
        });
    } catch (error) {
        res.status(error.response?.status || 500).json({ error: error.message });
    }
  };